package aa;

import java.util.ArrayList;

import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.MatOfFloat;
import org.opencv.core.MatOfInt;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.imgproc.Imgproc;

import com.attilax.img.util.OpencvUtil;

public class jfotu {

	public static void main(String[] args) {
		System.load("D:\\0workspace\\atiplat_img\\dll\\opencv_java2413.dll");
		Mat image = OpencvUtil.imread("D:\\0clr\\a.jpg");
		Mat gray = new Mat(image.height(), image.width(), CvType.CV_8U, new Scalar(0));
		Imgproc.cvtColor(image, gray, Imgproc.COLOR_BGR2GRAY);
		Mat hist = new Mat(256, 100, CvType.CV_8U, new Scalar(0));
	ArrayList histsSource = new ArrayList();
		histsSource.add(gray);
		Imgproc.calcHist(histsSource, new MatOfInt(0), new Mat(), hist, new MatOfInt(256), new MatOfFloat(0f, 256f));
	 Highgui.imwrite("d:\\0clr\\00hist.jpg", hist);
		System.out.println(hist);
		System.out.println(hist.dump());
	//	intpixAll = gray.rows() * gray.cols();
	//	Mat histNorm = new Mat(hist.rows(), hist.cols(), hist.type());
	//	Core.divide(hist, new Scalar(pixAll), histNorm);
	//	System.out.println(histNorm);
//		System.out.println(histNorm.dump());
	}

}
